package Unicart.pages;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

import static org.openqa.selenium.support.ui.ExpectedConditions.*;

public class SuccessOrderingPage extends AnyPage {

	public SuccessOrderingPage(PageManager pages) {
		super(pages);
	}

	@FindBy(xpath ="//li[1]/span/span[@class='b-order-success_info-item_definition_in']")
	private WebElement orderId;
	
	public String getOrderID() {
		return orderId.getText();
	}
	
	public SuccessOrderingPage ensurePageLoaded() {
		super.ensurePageLoaded();
		wait.until(presenceOfElementLocated(By.xpath("//div[@class='b-title b-order-success_title' and .='Ваш заказ успешно оформлен']")));
		return this;
	}
  
}
